<template>
  <van-list v-model="loading" :finished="finished" finished-text="没有更多了" @load="loadFunc">
    <slot name="default"></slot>
  </van-list>
</template>

<script>
  import {VueExtend} from 'godspen-lib'
  // 引入vant列表组件
  import { List } from 'vant'

  export default {
    mixins: [VueExtend.mixin],
    name: 'VantList',
    label: process.env.LABEL,
    style: process.env.STYLE,
    stack: false, // 是否是堆叠模式 ，false：孩子元素会按楼层一个个向下排布， true: 孩子元素绝对定位，随意放置位置
    childLimit: 9999,  // 孩子元素最大限制数
    leaf: false, // 是否是叶子节点，为true的时候该节点下面不能添加节点
    props: {
    },
    components: {
      [List.name]: List
    },
    slots: ['default'],
    data() {
      return {
        loading: false,
        finished: false,
      }
    },
    computed: {
    },
    editorMethods: {
    },
    methods: {
      loadFunc() {
        setTimeout(() => {
          // 加载状态结束
          this.loading = false;
          this.finished = true;
          console.log('加载完成', this)
        }, 1000)
      }
    }
  }
</script>

<style lang="stylus" rel="stylesheet/stylus" type="text/stylus" scoped>
  .component {
    width: 100%;
    height: 100%;
  }
</style>
